package c1702;


import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.*;

public class E {
    static Scanner cin = new Scanner(new BufferedInputStream(System.in));
    static PrintWriter cout = new PrintWriter(new BufferedOutputStream(System.out));
    static PrintWriter cerr = new PrintWriter(System.err);

    public static void main(String[] args) {
        Score.a = cin.nextDouble();
        Score.b = cin.nextDouble();
        Score.c = cin.nextDouble();
        Score.d = cin.nextDouble();
        Score.t = cin.nextDouble();
        List<Score> list = new ArrayList<>();
        while (cin.hasNext()) {
            String name = cin.next();
            double a = cin.nextDouble();
            double b = cin.nextDouble();
            double c = cin.nextDouble();
            double d = cin.nextDouble();
            double t = cin.nextDouble();
            Score score = new Score(name, a, b, c, d, t);
            if (score.checkPass())
                list.add(score);
        }
        list.sort(Comparator.comparing(Score::getT).reversed().thenComparing(Score::getName));
        int i = 1;
        for (Score s : list) {
            cout.printf("%s %d %d %.1f %d\n", s.name, (int) s.getIT(), (int) s.st, s.getT(), i++);
        }

        cin.close();
        cout.close();
    }

    static class Score {
        static double a, b, c, d, t;
        String name;
        double sa, sb, sc, sd, st;

        public String getName() {
            return name;
        }

        public double getIT() {
            return sa + sb + sc + sd;
        }

        public double getT() {
            return (sa + sb + sc + sd) * 0.6 + st * 0.4;
        }

        public Score(String name, double sa, double sb, double sc, double sd, double st) {
            this.name = name;
            this.sa = sa;
            this.sb = sb;
            this.sc = sc;
            this.sd = sd;
            this.st = st;
        }

        public boolean checkPass() {
            if (sa > a && sb > b && sc > c && sd > d && getIT() > t && st >= 60)
                return true;
            return false;
        }


    }


}

